/*
 * @author: sanbao
 * @Date: 2022-08-30 22:50:12
 */
import axios from 'axios'
import store from '../store'

const instance = axios.create({
    baseURL: '/api',
    timeout: 10000
  });
// 请求拦截
instance.interceptors.request.use(config=> {
   config.headers.Authorization ='Bearer ' + store.state.user.token || ''
    return config
  }, err => {
    Promise.reject(err)
  });

instance.interceptors.response.use(function(res){
    return res.data
},function(error){
    return Promise.reject(error)
});
export default instance

